Skip to content

Keep the staged other-workspace card feed checked after linking - #103994

Merged
lakchote merged 3 commits into
mainfrom
claude-keepStagedCompanyCardFeedChecked
Oct 20, 2026
Merged

lakchote merged 3 commits into
mainfrom
claude-keepStagedCompanyCardFeedChecked

Conversation

@MelvinBot

@MelvinBot MelvinBot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Explanation of Change

In the company card feed selector, a feed from another workspace was staged in draftFeed by its row value, ${fundID}_${feed}. On Save, the link response reaches Onyx before the RHP closes. The feed then leaves "From other workspaces" and shows up in the available feeds list under its ${feed}#${fundID} key. The stale draftFeed matched no row, so the checkmark disappeared until the RHP closed.

This PR stages other-workspace feeds by the ${feed}#${fundID} key from the start, so the checkmark follows the feed into the available list:

  • useOtherFeedsForFeedSelector computes that key once and returns it as a new selectionValue field on CardFeedListItem. It reuses the key the hook already built for its duplicate-row check. When the fundID is missing or invalid, selectionValue is undefined instead of a feed#NaN key.
  • WorkspaceCompanyCardFeedSelectorPage uses selectionValue ?? value when staging a feed, when finding the staged other-workspace feed, and for the row checkmark.
  • The add/verify work email routes and the row error still use the original value, so those flows are unchanged.

The page test fixture now uses the real ${fundID}_${feed} row value (the old feed#123 value hid this bug). A new test checks the staged feed stays checked after the link response moves it into the available list. It fails without this fix.

AI tests run locally: npm run typecheck, npm run lint-changed, npm run spell-changed, npm run fmt (no diff), react-compiler-compliance-check check on both changed source files, and Jest for WorkspaceCompanyCardFeedSelectorPageTest, useOtherFeedsForFeedSelector.test and WorkspaceCompanyCardPageEmptyStateTest (23/23 pass). I did not run a browser check, because it needs an account with company card feeds in two workspaces.

Fixed Issues

$ #103551
PROPOSAL: #103551 (comment)

Tests

Precondition: Log in with an account that has two workspaces, each with its own company card feed.

  1. Go to ND
  2. Go to Workspace Settings > Company Cards for one of the workspaces.
  3. Click the card feed selector dropdown.
  4. Choose a feed from the other workspace (under "From other workspaces").
  5. Click Save.
  6. Verify the selected feed keeps its checkmark the whole time, without briefly disappearing, until the RHP closes.
  7. Verify the selected feed stays under "From other workspaces" and does not jump into the available feeds list before the RHP closes.
  • Verify that no errors appear in the JS console

Offline tests

QA Steps

Precondition: Log in with an account that has two workspaces, each with its own company card feed.

  1. Go to ND
  2. Go to Workspace Settings > Company Cards for one of the workspaces.
  3. Click the card feed selector dropdown.
  4. Choose a feed from the other workspace (under "From other workspaces").
  5. Click Save.
  6. Verify the selected feed keeps its checkmark the whole time, without briefly disappearing, until the RHP closes.
  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I verified any copy / text that was added to the app is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If the PR adds or modifies the UI:
    • I asked an AI agent to review the changes for accessibility issues and addressed its findings.
    • I tested with a screen reader (VoiceOver on macOS) and verified all new/changed elements are reachable with a logical focus order.
    • I verified all new/changed elements have meaningful accessible names and roles.
    • I verified state changes are announced (e.g. checked/unchecked, expanded/collapsed, selected).
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari

Stage other-workspace feeds by the feed#fundID key they get in the
available feeds list, computed once in useOtherFeedsForFeedSelector as
selectionValue (undefined when the fundID is missing). The checkmark
now follows the feed when linking moves it into the available list
before the RHP closes.

Co-authored-by: truph01 <truph01@users.noreply.github.com>
@MelvinBot
MelvinBot requested a review from a team October 14, 2026 13:54
@melvin-bot melvin-bot Bot added Melvin-Test-Android Melvin-Test-Web Triggers Melvin to run the testing steps of the PR on web labels Oct 14, 2026
@MelvinBot

Copy link
Copy Markdown
Contributor Author

I created this PR from an upstream branch since I don't have push access to your fork.

To take ownership of this branch and be able to push updates, run:

git remote add upstream https://github.com/Expensify/App.git
git fetch upstream claude-keepStagedCompanyCardFeedChecked
git checkout -b claude-keepStagedCompanyCardFeedChecked upstream/claude-keepStagedCompanyCardFeedChecked
git push -u origin claude-keepStagedCompanyCardFeedChecked

Then you can close this PR and open a new one from your fork.

@MelvinBot

MelvinBot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 Android test steps verification results: ⚠️ partial

This PR has no test steps yet, so I used the reproduction steps from the linked issue. The Company Cards page loads, but I could not test the fix. Adding a card feed asks for a 6-digit code sent by email, and this test session can't read that inbox. So neither workspace got a feed, and I could not open the feed selector.
Account validation screen blocking Add cards on workspace 1

Step Status
Open Workspace Settings > Company Cards for one of the workspaces; the company cards page loads.Opened Company Cards for both workspaces. Each shows the empty state with an "Add cards" button.
Company Cards settings page loaded for workspace 1
✅
Tap the card feed selector dropdown; the feed selector RHP opens and shows a "From other workspaces" section containing the other workspace's feed.Blocked: neither workspace has a card feed, so there is no selector. Tapping "Add cards" in both workspaces opens a validation screen that needs a 6-digit code sent by email.
Account validation screen blocking Add cards on workspace 1
⚠️
Choose the feed from the other workspace; it shows a checkmark.Blocked: I could not open the feed selector (see step 2).
⚠️
Tap Save; the selected feed keeps its checkmark the whole time until the RHP closes (no brief disappearance).Blocked: there was no feed to select or save (see step 2).
⚠️
After the RHP closes, the Company Cards page shows the newly selected feed.Blocked: no feed was created (see step 2).
⚠️

To finish this test, use an account that already has a validated login and company card feeds in two workspaces.


view run · view recording

@truph01

truph01 commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

@MelvinBot Mark this PR as ready

@MelvinBot

MelvinBot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 Web test steps verification results: ⚠️ partial

This PR has no test steps yet, so I used the reproduction steps from the linked issue. The Company Cards page loads, but I could not test the fix. Adding a card feed asks for a 6-digit code sent by email, and this test session can't read that inbox. So neither workspace got a feed, and I could not open the feed selector.
Invalid magic code error after trying 123456

Step Status
Open Workspace Settings > Company Cards for one of the workspaces; the company cards page loads.The Company Cards page loads and shows the "Bring your own cards" empty state with an "Add cards" button.
Company Cards page loaded with Add cards button
✅
Click the card feed selector dropdown; the feed selector RHP opens and shows a "From other workspaces" section containing the other workspace's feed.Blocked: neither workspace has a card feed, so there is no selector. Clicking "Add cards" opens "Validate your account", which needs a 6-digit code sent by email. The placeholder code 123456 was rejected.
Validate your account screen asking for an emailed 6-digit code
Invalid magic code error after trying 123456
⚠️
Choose the feed from the other workspace; it shows a checkmark.Blocked: I could not open the feed selector (see step 2).
⚠️
Click Save; the selected feed keeps its checkmark the whole time until the RHP closes (no brief disappearance).Blocked: there was no feed to select or save (see step 2).
⚠️
After the RHP closes, the Company Cards page shows the newly selected feed.Blocked: no feed was created (see step 2).
⚠️

To finish this test, use an account that already has a validated login and company card feeds in two workspaces.


view run · view recording

@MelvinBot
MelvinBot marked this pull request as ready for review October 14, 2026 14:23
@MelvinBot
MelvinBot requested a review from a team as a code owner October 14, 2026 14:23
@melvin-bot
melvin-bot Bot requested a review from truph01 October 14, 2026 14:23
@MelvinBot

Copy link
Copy Markdown
Contributor Author

🤖 This PR is now marked as ready for review.

The Tests and QA Steps sections still have TODO placeholders. Please fill them in, and add screenshots or videos, before the review starts.


view run

@melvin-bot
melvin-bot Bot removed the request for review from a team October 14, 2026 14:23
@melvin-bot

melvin-bot Bot commented Oct 14, 2026

Copy link
Copy Markdown

@truph01 Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@melvin-bot
melvin-bot Bot requested review from flaviadefaria and removed request for a team October 14, 2026 14:23
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-15T03:36:30.902210Z 4941190 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@truph01

truph01 commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

@MelvinBot The checkmark stays now, but the feed still moves during the RHP close animation. The linkCardFeedToPolicy response updates linkedPolicyIDs before .then() runs, so the feed jumps from "From other workspaces" into the available list.

Please freeze the lists while linking in WorkspaceCompanyCardFeedSelectorPage.

Co-authored-by: truph01 <truph01@users.noreply.github.com>
@MelvinBot
MelvinBot requested a review from a team as a code owner October 15, 2026 03:27
@melvin-bot
melvin-bot Bot requested review from lakchote and mountiny and removed request for a team October 15, 2026 03:27
@melvin-bot

melvin-bot Bot commented Oct 15, 2026

Copy link
Copy Markdown

@lakchote @mountiny One of you needs to copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@MelvinBot

Copy link
Copy Markdown
Contributor Author

I pushed a fix. The page now freezes both feed lists while the link request runs, so the feed stays under "From other workspaces", still checked, until the RHP closes.

  • Line 84-87: the page renders from a snapshot of companyCardFeeds and otherFeeds when one exists.
  • Line 171: Save takes the snapshot right before calling linkCardFeedToPolicy.
  • Line 178: if the link fails, the page drops the snapshot so the open page shows current data and the error.

The page test now checks two things. The feed stays in place when the response lands before close; this test fails without the fix. When linking fails, the page shows the live lists again.

Checks run

Jest for WorkspaceCompanyCardFeedSelectorPageTest and useOtherFeedsForFeedSelector.test (18/18 pass), npm run typecheck, npm run lint-changed, npm run spell-changed, npm run fmt (no diff), and the React Compiler check on the page. I did not test in a browser, because it needs an account with card feeds in two workspaces.


view run

@truph01

truph01 commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: 49411907cf

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@truph01

truph01 commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified that the composer does not automatically focus or open the keyboard on mobile unless explicitly intended. This includes checking that returning the app from the background does not unexpectedly open the keyboard.
  • I verified tests pass on all platforms & I tested again on:
    • Android: HybridApp
    • Android: mWeb Chrome
    • iOS: HybridApp
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick).
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained """"why"""" the code was doing something instead of only explaining """"what"""" the code was doing.
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • For any bug fix or new feature in this PR, I verified that sufficient unit tests are included to prevent regressions in this flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Android: HybridApp
Screen.Recording.2026-10-15.at.13.43.05.mov
Android: mWeb Chrome
iOS: HybridApp
iOS: mWeb Safari
MacOS: Chrome / Safari
Screen.Recording.2026-10-15.at.13.35.22.mov

@lakchote

Copy link
Copy Markdown
Contributor

@truph01 thanks, tests section and QA steps in the PR body are still TODO though, can you fill them in?

@truph01

truph01 commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

@MelvinBot Update QA test section based on test steps in #103551

@MelvinBot

Copy link
Copy Markdown
Contributor Author

I updated the QA Steps section using the reproduction steps from Company Card - Checkbox disappears briefly when switching company card feed:

Precondition: Log in with an account that has two workspaces, each with its own company card feed.

  1. Go to staging.new.expensify.com
  2. Go to Workspace Settings > Company Cards for one of the workspaces.
  3. Click the card feed selector dropdown.
  4. Choose a feed from the other workspace (under "From other workspaces").
  5. Click Save.
  6. Verify the selected feed keeps its checkmark the whole time, without briefly disappearing, until the RHP closes.
  • Verify that no errors appear in the JS console

The Tests section is unchanged. It still has its TODO.


view run

@truph01

truph01 commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

@MelvinBot Update the step 1 "Go to staging.new.expensify.com" to "Go to ND".
Also, fill out the "Tests" section as well.

@MelvinBot

Copy link
Copy Markdown
Contributor Author

I updated the PR description:

  • QA Steps: Step 1 now says "Go to ND".
  • Tests: I replaced the TODO with the same steps as QA. I also added step 7, which checks the list freeze added in the latest commit:
  1. Verify the selected feed stays under "From other workspaces" and does not jump into the available feeds list before the RHP closes.

If you want QA to check that too, I can add step 7 to QA Steps.


view run

@truph01

truph01 commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

@truph01 thanks, tests section and QA steps in the PR body are still TODO though, can you fill them in?

@lakchote It's done

@lakchote lakchote left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left one NAB and I'll approve @truph01 (put an empty line before the comment unless it’s on the first line of a block, as stated in our styling guidelines).

Comment thread src/hooks/useOtherFeedsForFeedSelector.tsx
Co-authored-by: truph01 <truph01@users.noreply.github.com>

@lakchote lakchote left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, looks good.

@lakchote
lakchote merged commit 840dc3d into main Oct 20, 2026
43 of 44 checks passed
@lakchote
lakchote deleted the claude-keepStagedCompanyCardFeedChecked branch October 20, 2026 09:27
@github-actions

Copy link
Copy Markdown
Contributor

🚧 lakchote has triggered a test Expensify/App build. You can view the workflow run here.

@OSBotify

Copy link
Copy Markdown
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/lakchote in version: 9.5.15-1 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

@MelvinBot

Copy link
Copy Markdown
Contributor Author

No help site update is needed. This PR fixes a bug: the checkmark on an other-workspace card feed disappeared for a moment after you clicked Save. Now the checkmark stays, which is what users already expect, so no article sentence becomes wrong.


view run

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/grgia in version: 9.5.15-3 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

Bundle Size Analysis (Sentry):

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Melvin-Test-Android Melvin-Test-Web Triggers Melvin to run the testing steps of the PR on web

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants